﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

/// <summary>
/// Summary description for LocalVariables
/// </summary>
public class LocalVariables
{
    public static bool HIDDEN_LOGO = true;

    public static string CONNECT_FAILURE = "Username or password invalid";
    public static string KEYWORD_FAILURE = "Keyword is not empty";
    public static string USERNAME_FAILURE = "Username is not empty";
    public static string PASSWORD_CHARACTERS = "Password must be greater than 6 characters";
    public static string PASSWORD_FAILURE = "Password is not empty";
    public static string CPASSWORD_FAILURE = "Confirm password invalid";
    public static string ADD_USER_SUCCESS = "Add user successfully";
    public static string USERS_BEEN_USED = "Users have been used";
    public static string EMAIL_BEEN_USED = "Email have been used";
    public static string EDIT_PROFILE_USER = "Profile changes successfully";
    public static string SEARCH_NOT_RESULTS = "Found no search results : 0 record";

    public static string QUESCODE_FAILURE = "Questions code is not empty";
    public static string CONTENT_FAILURE = "Content code is not empty";
    public static string SCORE_FAILURE = "Score code is not empty";
    public static string CHOOSE_QUES_TYPE = "Please choose the type of questions";
    public static string SELECT_ANSWER = "Select the correct answer";
    public static string QCODE_BEEN_USED = "Questions code have been used";
    public static string ADD_QUES_SUCCESS = "Add questions successfully";
    public static string EDIT_QUES_SUCCESS = "Edit questions successfully";

    public static string ADD_EXAM_SUCCESS = "Add exam successfully";
    public static string EXAMCODE_FAILURE = "Exam code is not empty";
    public static string CHOOSE_EXAM_TYPE = "Please choose the type of exam";
    public static string LIMIT_10_QUESTION = "Limited to 10 questions";

    public static string NAME_FAILURE = "Name is not empty";
    public static string ADDRESS_FAILURE = "Address is not empty";
    public static string CITY_FAILURE = "City is not empty";
    public static string COUNTRY_FAILURE = "Country is not empty";
    public static string DESCRIP_FAILURE = "Description is not empty";
    public static string BIRTHDAY_FAILURE = "Birthday is not empty";
    public static string CANDIDATE_USER_SUCCESS = "Add candidate successfully";

    public static string EMAIL_FAILURE = "Email is not empty";
    public static string CODE_LOGIN_FAILURE = "Code login is not empty";
    public static string CHOOSE_DATE_EXAM = "Please choose exam";
    public static string CHOOSE_DATE_TEST = "Please choose date test";
    public static string CHECK_DATE_TEST = "Date test must be greater than current date";
    public static string ROUND_IS_CLOSED = "Round is closed";
    public static string ADD_ROUND_SUCCESS = "Add round successfully";
    public static string EDIT_ROUND_SUCCESS = "Edit round successfully";
    public static string CHANGE_PASS_SUCCESS = "Change password successfully";
    public static string OLD_PASS_INVALID = "Old password invalid";

    public static string WAITING_FOR_CHECKS = "Waiting for checks from the employer";
    public static string NEW_OLD_PASS = "New password and old password is not the same";
    public static string PASSED_ROUND = "You've passed this round";
    public static string NOT_DATE_TEST = "Inspection date is not today";
    public static string LESS_TEST_TIME = "Less test time";
    public static string EMAIL_DOES_NOT_EXITST = "Email address does not exist";
    public static string NEW_PASSWORD_SEND_MAIL = "New password has been sent on this mail";
    public static string EXAM_NO_QUESTION =  "Exam no questions";
    public static string EXAM_TYPE_NOT_QUESTION = "Exam type not enough question, request must be more than 10 question";

    public static string SQLQUERY_SELECT_TABLE_CANDIDATE    = "SELECT * FROM Candidate ORDER BY id DESC";
    public static string SQLQUERY_SELECT_TABLE_MANAGER      = "SELECT * FROM Manager ORDER BY id DESC";
    public static string SQLQUERY_SELECT_TABLE_QUESTIONS    = "SELECT * FROM Questions ORDER BY id DESC";
    public static string SQLQUERY_SELECT_TABLE_EXAM         = "SELECT * FROM Exam ORDER BY id DESC";
    public static string SQLQUERY_SELECT_TABLE_EXAM_CODE    = "SELECT * FROM ExamCode ORDER BY id DESC";
    public static string SQLQUERY_SELECT_TABLE_TESTS        = "SELECT * FROM Tests ORDER BY id DESC";

    public static string MAIL_TOPIC         = "Online Aptitude Test";
    public static string MAIL_SERVER        = "smtp.gmail.com";
    public static string MAIL_ADDRESS       = "congphanhoang@gmail.com";
    public static string MAIL_PASSWORD      = "phanhoangcong";

    public static string SAVE_VALUE_EMAIL   = "";
    public static string SAVE_VALUE_AVATAR  = "";

    public static string[] CONTENT      = new string[10];
    public static string[] ANSWER_TRUE  = new string[10];
    public static string[] ANSWER       = new string[10];
    public static string[] QUESTION     = new string[10];

    public static void clearValue()
    {
        for(int i = 0; i < ANSWER.Length; i++)
        {
            CONTENT[i]      = "";
            ANSWER[i]       = "";
            ANSWER_TRUE[i]  = "";
            QUESTION[i]     = "";
        }
    }

    public static string[] ARRAY_INFOR_CANDIDATE = null;

    public static bool isNullorEmpty(string text)
    {
        string txt = text.Trim();
        if (txt == null || txt == "" || txt.Equals("&nbsp;"))
        {
            return true;
        }
        return false;
    }

    public static string getFileName(string user, string filename)
    {
        string[] typeFile = filename.Split('.');
        user += DateTime.Now.ToString("ddMMyyyyHHmmss") + "." + typeFile[typeFile.Length-1];
        return user;
    }

    public static int getCurrentDate()
    {
        int date = Convert.ToInt32(DateTime.Now.ToString("yyyyMMdd"));
        return date;
    }

    public static string getDate()
    {
        return DateTime.Now.ToString("yyyy-MM-dd").Trim();
    }

    public static int getTime()
    {
        return Convert.ToInt32(DateTime.Now.ToString("HHmm").Trim());
    }

    public static string getCurrentDateTime()
    {
        return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Trim();
    }

    public static string randomPassword()
    {
        Random random = new Random();
        string newpass = Convert.ToString(random.Next(100000, 999999)); 
        return newpass;
    }
}